package code.part02_objectOriented;

/**
 * @author: ZJT
 * @Time: 2021/7/8
 * @Description: 变量
 */
public class P03_Var {
    int age = 20;

    public final  String name = "zhangsan";


    public void show(){
        //局部变量
        int a ;
        System.out.println(age);
//        System.out.println(a);//Variable 'a' might not have been initialized
    }


    public static void main(String[] args) {
       P03_Var var = new P03_Var();
        System.out.println(var.age);
        //局部变量不会影响全局变量
        var.test();
        System.out.println(var.age);

    }

    public void test(){
        age = 10;
        System.out.println(age);
        int age = 30;
        System.out.println(age);
    }
}
